package com.supplychain.scm.core.common.validator.openapi;

import cn.hutool.core.util.StrUtil;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class ApiMethodValidator implements ConstraintValidator<ApiMethod, String> {

	@Override
	public void initialize(ApiMethod annotation) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		// 如果方法名为空
		if (StrUtil.isEmpty(value)) {
			return false;
		}
		//校验
		if (!value.startsWith("dby.")) {
			return false;
		}
		return true;
	}

}
